home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Genie / Projects / Pedestal / Source / Sources / Menus / PedMenuEdit.cc < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  1.1 KB  |  83 lines

  1. /*    ================
  2.  *    PedMenuEdit.cpp
  3.  *    ================
  4.  */
  5.  
  6. #include "PedestalDebugging.h"
  7.  
  8. #include "PedMenuEdit.hh"
  9. #include "PedCommand.hh"
  10.  
  11. enum {
  12.     idAppleMENU = 128, // menu ID = 1
  13.     idFileMENU,
  14.     idEditMENU
  15. };
  16.  
  17.  
  18. PedMenuEdit::PedMenuEdit()
  19. : mUndoCmd(NULL), mCutCmd(NULL), mCopyCmd(NULL), mPasteCmd(NULL), mClearCmd(NULL)
  20. , mSelectAllCmd(NULL)
  21. {
  22.     GetFromResource(idEditMENU);
  23. }
  24.  
  25. void
  26. PedMenuEdit::InstallCommand(PedCommand *inCmd, CmdCode inCode)
  27. {
  28.     switch (inCode) {
  29.         case 'undo':
  30.             mUndoCmd = inCmd;
  31.             break;
  32.         case 'cut ':
  33.             mCutCmd = inCmd;
  34.             break;
  35.         case 'copy':
  36.             mCopyCmd = inCmd;
  37.             break;
  38.         case 'pste':
  39.             mPasteCmd = inCmd;
  40.             break;
  41.         case 'clea':
  42.             mClearCmd = inCmd;
  43.             break;
  44.         case 'slct':
  45.             mSelectAllCmd = inCmd;
  46.             break;
  47.         default:
  48.             break;
  49.     }
  50. }
  51.  
  52. void
  53. PedMenuEdit::DoMenuItem(short inItem)
  54. {
  55.     PedCommand *cmd;
  56.     
  57.     switch (inItem) {
  58.         case 1:
  59.             cmd = mUndoCmd;
  60.             break;
  61.         case 3:
  62.             cmd = mCutCmd;
  63.             break;
  64.         case 4:
  65.             cmd = mCopyCmd;
  66.             break;
  67.         case 5:
  68.             cmd = mPasteCmd;
  69.             break;
  70.         case 6:
  71.             cmd = mClearCmd;
  72.             break;
  73.         case 7:
  74.             cmd = mSelectAllCmd;
  75.             break;
  76.         default:
  77.             cmd = NULL;
  78.             break;
  79.     }
  80.     if (cmd)
  81.         cmd->Execute();
  82. }
  83.